﻿using YS.Domain.IoT.Receive;
namespace YS.K12.Core.IoT.Adapter
{
    /// <summary>
    /// 自定义区间适配器
    /// </summary>
    public class YsBetweenAndDataHandlingAdapter : CustomBetweenAndDataHandlingAdapter<BetweenAndRequestInfo>
    {
        private readonly byte[] m_startCode;
        private readonly byte[] m_endCode;
        public override byte[] StartCode => m_startCode;

        public override byte[] EndCode => m_endCode;

        public YsBetweenAndDataHandlingAdapter()
        {
            this.MinSize = 5;//表示，实际数据体不会小于5，例如“**12##12##”数据，解析后会解析成“12##12”

            this.m_startCode = Encoding.UTF8.GetBytes("###");//可以为0长度字节，意味着没有起始标识。
            this.m_endCode = Encoding.UTF8.GetBytes("&&&");//必须为有效值。
        }

        protected override BetweenAndRequestInfo GetInstance()
        {
            return new BetweenAndRequestInfo();
        }

    }
}
